package com.tom.job;

import com.tom.service.IArticleService;
import com.tom.service.SynchronousArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * All rights Reserved, Designed By www.tom.com
 *
 * @version V1.0
 * @Package bw-article-api
 * @Description:
 * @author: dengyi
 * @date: 2020/2/13
 * @Copyright: 2019 www.tomonline-inc.com Inc. All rights reserved.
 * 注意：本内容仅限于TOM集团内部传阅，禁止外泄以及用于其他的商业目
 */

@Component
public class ArticleJob {

    @Autowired
    private IArticleService articleService;

    @Autowired
    private SynchronousArticleService synchronousArticleService;

    //免费文章定时任务
//    @Scheduled(cron = "${bw-article.TIME_ALLOCATION}")
    public void process() {
        articleService.listArticle();
    }

    //付费文章定时器任务
//    @Scheduled(cron = "${bw-article.TIME_ALLOCATION_CHARGE}")
    public void charge() {
        articleService.chargeListArticle();
    }


    /**
     * 原生数位稿定时器任务
     */
//    @Scheduled(cron = "${bw-article.TIME_ALLOCATION_DIGITAL_NATIVE}")
    public void digitalNative() {
        articleService.digitalNative();
    }

    @Scheduled(cron = "${bw-article.add-article}")
    private void addArticle(){
        synchronousArticleService.addArticle();
    }

    @Scheduled(cron = "${bw-article.update-article}")
    private void updateArticle(){
        synchronousArticleService.updateArticle();
    }


}
